<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <!-- 
      事件对象event
      1. 内联写法：使用 $event 来保存事件对象
      2. 函数写法：函数的第一个参数就是事件对象

     -->
    <template id="t1">
      <div>
        <!-- 内联 -->
        <!-- <button @click="($event)=>{log($event)}">click</button> -->
        <button @click="log($event)">click</button>
        <button @click="say">click</button>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          num: 100,
        },
        methods: {
          log(ctx) {
            console.log(ctx);
          },
          say(e) {
            console.log(e);
          },
        },
      });
    </script>
  </body>
</html>
